import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Main {
    public static void main(String[] args) {
        // 创建两个班级并添加学生
        Classroom class1 = new Classroom("一班");
        class1.addStudent(new Student("虞林润", "2023015476", "一班"));
        class1.addStudent(new Student("康新浩", "2023015467", "一班"));
        class1.addStudent(new Student("刘东亮", "2023015458", "一班"));
        class1.addStudent(new Student("刘岷亿", "2023015499", "一班"));

        Classroom class2 = new Classroom("二班");
        class2.addStudent(new Student("赵六", "004", "二班"));
        class2.addStudent(new Student("孙七", "005", "二班"));
        class2.addStudent(new Student("周八", "006", "二班"));

        // 创建小组并添加学生（这里假设已经分好）
        List<Student> group1Students = new ArrayList<>();
        group1Students.add(class1.getStudents().get(0)); // 虞林润
        group1Students.add(class1.getStudents().get(1)); // 康新浩

        List<Student> group2Students = new ArrayList<>();
        group2Students.add(class1.getStudents().get(2)); // 刘东亮
        group2Students.add(class1.getStudents().get(3)); // 刘岷亿

        Group group1 = new Group(1, group1Students);
        Group group2 = new Group(2, group2Students);

        List<Group> groups = new ArrayList<>();
        groups.add(group1);
        groups.add(group2);

        // 随机选择一个小组序号
        Random random = new Random();
        int groupIndex = random.nextInt(groups.size());
        Group selectedGroup = groups.get(groupIndex);

        // 在小组里随机选一个学生名
        Student randomGroupStudent = selectedGroup.getRandomStudent();
        System.out.println("随机选择的小组序号是: " + selectedGroup.getGroupId());
        System.out.println("小组里的随机学生: " + randomGroupStudent.getName());

        // 在班级里随机选一个学生姓名（这里以一班为例）
        Student randomClassStudent = class1.getRandomStudent();
        System.out.println("一班里的随机学生: " + randomClassStudent.getName());
    }
}